import React, { Component, lazy, Suspense } from 'react'
import {Route, Switch, Redirect} from 'react-router-dom'

import Loading from '../../Components/Loading'
import "./index.css"

import HomeNav from "./HomeNav"
// import News from "./News"
// import Message from "./Message"

const News = lazy(() => import('./News'))
const Message = lazy(() => import('./Message'))

export default class Home extends Component {
    render() {
        return (
            <div>
                我是Home内容
                <div className="navHomeContainer">
                    <HomeNav/>
                </div>
                <div className="homeMain">
                    <Switch>
                        <Suspense fallback={<Loading />}>
                            <Route path="/home/news" component={News} />
                            <Route path="/home/message" component={Message} />
                            <Redirect to="/home/news" />
                        </Suspense>
                    </Switch>
                </div>
            </div>
        )
    }
}
